package lib

import (
	"fmt"
	"github.com/PuerkitoBio/goquery"
)

func SearchName(url string) (filename, downloadurl string) {
	d, err := goquery.NewDocument(url)
	if err != nil {
		fmt.Println("Search webpage err:%s", err)
		return
	}
	filename = d.Find(".con-right h1").Text()
	downloadurl, _ = d.Find(".btn a").First().Next().Attr("href")
	return
}
func Search_chinaz(url string) (downloadurl string) {
	d, err := goquery.NewDocument(url)
	if err != nil {
		fmt.Println("Search webpage err:%s", err)
		return
	}

	downloadurl, _ = d.Find(".downbody .dian ").First().Find("a").Attr("href")
	return
}

//获取懒人图库的脚本
func Search_lrtk(url string) (name string) {
	d, err := goquery.NewDocument(url)
	if err != nil {
		fmt.Println("Search webpage err:%s", err)
		return
	}

	name = d.Find(".title h1 ").Text()
	return
}
